package tdemo;
class Animal
{
    int age;
    String name;
    public Animal(int age)
    {
        this.age=age;
    }

    public void eat()
    {
        System.out.println(name+"吃饭");
    }
}
class Dog extends Animal
{
    String name;
    String silly="笨小狗";
    public Dog(String name,int age)
    {
        super(age);
        this.name=name;
    }
    public void eat()
    {
        System.out.println(name+"吃狗粮");
    }
}
class Cat extends Animal
{
    public Cat(String name,int age)
    {
        super(age);
        this.name=name;
    }
    String name;
    public void eat()
    {
        System.out.println(name+"吃猫粮");
    }
}
class Panda extends Animal
{
    public Panda(String name,int age)
    {
        super(age);
        this.name=name;
    }
    String name;
    public void eat()
    {
        System.out.println(name+"吃熊粮");
    }
}

public class text {
    public static void eatfood(Animal animal)
    {
        animal.eat();
    }


    public static void main89(String[] args) {
        Animal animal=new Dog("wang",7);
        if(animal instanceof Dog) {
            Dog dog1 = (Dog) animal;
            System.out.println(dog1.silly);
        }

    }

    /*public static void main2(String[] args) {

        Dog dog=new Dog("wang",7);
        Animal ainmal=dog;
        //if(animal instanceof Dog)
       // {
            Dog dog1=Dog(Animal);
            System.out.println(dog1.silly);


       // }

    }

   public static void main(String[] args) {
        Dog dog=new Dog("wang",7);
        Animal ainmal=dog;
        System.out.println(animal.name);
        System.out.println(animal.age);

    }



    /*public static void main3(String[] args) {
        Dog dog=new Dog();
        //Animal animal=dog;
        eatfood(dog);
      eatfood(new Cat());
       eatfood(new Panda());

    }
    */

    /*public static void main(String[] args) {
        //Dog dog=new Dog("wang",9);
       // Animal animal=dog;
        Animal.animal=new Dog("wang",9);
        System.out.println(animal.age);
        //animal.eat();
        //System.out.println(aimal.eat);
        //System.out.println(animal.age);

    }


    /*public static void main111(String[] args) {
        Dog dog=new Dog("wang",6);
        Animal animal=dog;
        System.out.println(animal.age);
        //System.out.println(animal.name);

    }

     */









}
